<?php
require_once('../../../localconf.php');
$link = mysql_connect($typo_db_host, $typo_db_username, $typo_db_password);
mysql_select_db($typo_db);

if($_GET['process_sorting'] == 1){
	processSorting();			
}

if($_GET['process_hidden'] == 1){
	processHidden();			
}

function processSorting(){
	foreach($_GET['listItem'] as $position => $item){
		$sql = 'UPDATE tx_ttnewsshare_networks SET sorting="'.intval($position).'" WHERE uid="'.intval($item).'" AND deleted="0"'; 
		mysql_query($sql);
	}
}

function processHidden(){
	if($_GET['hidden'] == 1){
		$sort = ', sorting="10000"';
	}
	
	$sql = 'UPDATE tx_ttnewsshare_networks SET hidden="'.intval($_GET['hidden']).'"'.$sort.' WHERE uid="'.intval($_GET['uid']).'" AND deleted="0"'; 
	mysql_query($sql);
	print($sql);
}

mysql_close($link);

?>